|
|
|
|
|
|
|
When you run the application, you should see every Sunday bolded as shown in Figure 15.12. |
|
|
|
|
|
|
|
|
Figure 15.12.
Changing the font properties to highlight
important dates. |
|
|
|
|
|
|
|
|
Although this control is very useful, it does take up a lot of space on a form. When you have space requirements or do not need to display a calendar all the time, you should consider using the other new date controlthe DateTimePicker control. |
|
|
|
|
|
|
|
|
The DateTimePicker Control |
|
|
|
|
|
|
|
|
If you are short of space on a form, but need a date control on the form, you should use the DateTimePicker control. This control presents itself as a drop-down box (see Figure 15.13). |
|
|
|
|
|
|
|
|
Figure 15.13.
Adding a DateTimePicker control takes
up as much space as a DropDown
control. |
|
|
|
|
|
|
|
|
When the DateTimePicker is dropped down, a MonthView calendar is displayed. Depending on whether you are working with dates or times, the control has the following two different modes: |
|
|
|
|
|
|
|
|
Drop-down calendarEnables the user to display a drop-down calendar that can be used to select a date. |
|
|
|
|
|
|
|
|
Time formatAllows the user to select a field in the date display, and then press the up/down arrow to set its value. |
|
|
|
|
|
|
|
|
The control can be used to display the date in several preset formats, and you can also specify custom formats using the standard format strings. |
|
|
|
|
|
|
|
|
Because the DateTimePicker acts like a MaskedEdit control, each part of the date or time is treated as a separate field within the edit portion of the control. |
|
|
|
|
|